import { chromeFillOrSelectTool } from './chrome-fill-or-select.js';
import { chromeGetInteractiveElementsTool } from './chrome-get-interactive-elements.js';
import { chromeGetWebContentTool } from './chrome-get-web-content.js';
import { createDefaultTool } from './default-tool.js';

const TOOL_WHITELIST = [
  'get_windows_and_tabs',
  'chrome_navigate',
  'chrome_screenshot',
  'chrome_close_tabs',
  'chrome_go_back_or_forward',
  'chrome_get_web_content',
  'chrome_click_element',
  'chrome_fill_or_select',
  'chrome_get_interactive_elements',
  'chrome_network_request',
  'chrome_network_debugger_start',
  'chrome_network_debugger_stop',
  'chrome_network_capture_start',
  'chrome_network_capture_stop',
  'chrome_keyboard',
  'chrome_history',
  'chrome_bookmark_search',
  'chrome_bookmark_add',
  'chrome_bookmark_delete',
  'search_tabs_content',
  'chrome_inject_script',
  'chrome_send_command_to_inject_script',
  'chrome_console'
];

const TOOL_DEFINITIONS = {
  chrome_get_web_content: chromeGetWebContentTool,
  chrome_get_interactive_elements: chromeGetInteractiveElementsTool,
  chrome_fill_or_select: chromeFillOrSelectTool
};

export const isToolAllowed = (toolName) => TOOL_WHITELIST.includes(toolName);

export const getToolDefinition = (toolName) => (
  TOOL_DEFINITIONS[toolName] || createDefaultTool(toolName)
);
